let obj1 = {
    name: 'lang',
    arr: [1,[2,3],4]
}
// 浅拷贝？ 遍历原对象 拷贝一份 
function shallowClone(source) {
    var target = {};
    for(var i in source) {
        if (source.hasOwnProperty(i)) {
            target[i] = source[i];
        }
    }
    return target;
}
let obj3 = shallowClone(obj1)
obj3.name = '微浪'
console.log(obj1);

let obj2 = obj1
obj2.name = '字节浪'
// js 内存优化的需要， 复杂数据， 默认引用式赋值
console.log(obj1);
